UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XN90mS1kczfm2W/LBlltR2iQ7ILf0iWGL8NUStAs9O4='
WHERE
key_id = '99eb9c3afd5c11bc046007e23a3df34e9ebd2c20affbc4db94789ceb468b4616'
AND (
token = 'XN90mS1kczfm2W/LBlltR2iQ7ILf0iWGL8NUStAs9O4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)