UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HLdNizYwof5Ed0r18fvXXoJkRyghVpUOdmeYPI+PDd4='
WHERE
key_id = 'a03880d600ab4678293dc5ee69c27e4cb787dbfe65f8c9bb84747ee422385499'
AND (
token = 'HLdNizYwof5Ed0r18fvXXoJkRyghVpUOdmeYPI+PDd4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)