UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CO8/B1tUSdsV7snK2pYEJYCBYTN889jSE928BAu+u4I=' 
WHERE 
  key_id = 'd9500297b6d6ade5a3131b114e0ed72c89eb5334eddcefeb8b04871fbefe87fb' 
  AND (
    token = 'CO8/B1tUSdsV7snK2pYEJYCBYTN889jSE928BAu+u4I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045