UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NQW40PsSQd9NX+/848X17ajHhLOIR8iSFB9jfClW+Ec='
WHERE
key_id = 'dab8dc3b6be20b4c05d580fd588ea6d13dd68b7b367ecb848f0e63bc30f9b4db'
AND (
token = 'NQW40PsSQd9NX+/848X17ajHhLOIR8iSFB9jfClW+Ec='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)