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