UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'twJyVEKBQoJQm8VHcyICFfsWXidg7yyA/wf3oHa5EKg='
WHERE
key_id = '2f5ff792e348a81ea2e9f299a2ef7849d9f715e9e2d7a4f0df8c8cbfb6fe49cb'
AND (
token = 'twJyVEKBQoJQm8VHcyICFfsWXidg7yyA/wf3oHa5EKg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)