UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jxRT4NmHBF43Kjom2IvD9sTmI2kWE+Qwp70cf23RwGM='
WHERE
key_id = 'd87dd5b6b1c2a7ecf4b900abde6f3dddfb3e584de17a5e2b0ef68e43c72ec4a7'
AND (
token = 'jxRT4NmHBF43Kjom2IvD9sTmI2kWE+Qwp70cf23RwGM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)