UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fpzdF7hWipjV6qkFDa6s7BheapIrSNDOrw0IfTWqMYM='
WHERE
key_id = 'a74131fa4a5eb29554f8579d59742aa8f1169d21c33a2ae25379c96d3b8ea14f'
AND (
token = 'fpzdF7hWipjV6qkFDa6s7BheapIrSNDOrw0IfTWqMYM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)