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