UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iAM2k4d2w9p1X42H7dp9JttPH+FMuGOju1n8PKNIh9Q='
WHERE
key_id = '39d9ad522eb24d48875b629e620d4fb58fe267e7610b48a8efa3c034cf90ed84'
AND (
token = 'iAM2k4d2w9p1X42H7dp9JttPH+FMuGOju1n8PKNIh9Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)