UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8otJK+Rgxd61KnSf0b6FOr6nTu1JGGV+u5vVTfXur2o='
WHERE
key_id = '540916598a211ecf15f065cb9ffadab668f4b27a76c5549745aad63fc1370c66'
AND (
token = '8otJK+Rgxd61KnSf0b6FOr6nTu1JGGV+u5vVTfXur2o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)