UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OldsprXz5Q7stP/2V6XZiS8Nt8v13GIGchyp0VqjGX0='
WHERE
key_id = 'd3291888269e4e96628913ee9db5c000b88745bf6ceeaa87d6de4074fe4ff0ce'
AND (
token = 'OldsprXz5Q7stP/2V6XZiS8Nt8v13GIGchyp0VqjGX0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)