UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iTobiYYXnKKuvZPkhVVpVDh2KGuj6lJLU2B5VTF2j3w='
WHERE
key_id = '1a5d84603b5d618df2dad90016da3496e12c1e9758adee9038939c310d5dc20d'
AND (
token = 'iTobiYYXnKKuvZPkhVVpVDh2KGuj6lJLU2B5VTF2j3w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)