UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WYCP2yE/4a2sgfTU+nfmJKkGOFv5WbDNe1kt8jzxPdU=' 
WHERE 
  key_id = '7fc82462eb9ce4cd4d46c05f86330354f463674a587f9ba73cd238af7fab06c5' 
  AND (
    token = 'WYCP2yE/4a2sgfTU+nfmJKkGOFv5WbDNe1kt8jzxPdU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059