UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BfWdGqy9nhmt5DdOrrWjTVv0p+QNEVdIRcoMkD70XP4='
WHERE
key_id = 'cae69717bb311649a012e673f9274897527a3bf82fb63583651aba82aadd411f'
AND (
token = 'BfWdGqy9nhmt5DdOrrWjTVv0p+QNEVdIRcoMkD70XP4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)