UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pUA97pOqWzmJV/knJpwJw3PHVgnrKYz6RPBoYOypERM='
WHERE
key_id = 'c7ee672355de94e8bfe585107f71796431f9a0e15a621fb363d5337b66790ec8'
AND (
token = 'pUA97pOqWzmJV/knJpwJw3PHVgnrKYz6RPBoYOypERM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)