UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uunzKaA1BMC6wNGukfGdwsgC9X2r/9nE8srUPJXL7qw='
WHERE
key_id = 'f80e39a7eaea5264c1d51ee7efc51a73e12d8e2b16011ae283892d6a259f19e3'
AND (
token = 'uunzKaA1BMC6wNGukfGdwsgC9X2r/9nE8srUPJXL7qw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)