UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0OsOdIl1BPPkSqSDqCLIPdwqBV7AahKDP6+dZnjwtcE='
WHERE
key_id = '64529ca8b8d4a9e43648e6fa65c07d750440ffa600441341fa9e7db4e8a68e75'
AND (
token = '0OsOdIl1BPPkSqSDqCLIPdwqBV7AahKDP6+dZnjwtcE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)