UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y3J2NDUnonLj22GmSVL8NJpb41C6QtrPXsuBDmKzdE0='
WHERE
key_id = 'c7ceef5cd7b793ee2b0c9112381d662632f5bdb60b65becc323c871ed0dec039'
AND (
token = 'y3J2NDUnonLj22GmSVL8NJpb41C6QtrPXsuBDmKzdE0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)