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