UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KwaQEEC1tlR1+GFsTysdyVj1+csa/KQjhO84tRFT+iw='
WHERE
key_id = 'a086c8d86648263a8ec74e798176d425cd1c94b2c6fddf52b60cbc910d57f1cc'
AND (
token = 'KwaQEEC1tlR1+GFsTysdyVj1+csa/KQjhO84tRFT+iw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)