UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cM+yLIGz4CLPKHW/2rBx0cpexrPJeJZycfciRTSD+ss='
WHERE
key_id = 'd85f1cfdda8e78f36ccb5c7353ce2beebc346317bf55d9a0ca825920e0ea4c2c'
AND (
token = 'cM+yLIGz4CLPKHW/2rBx0cpexrPJeJZycfciRTSD+ss='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)