UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TuRAPU0mH+9a1W7BMA7vKNi2tLKoCwstEREpDMhUT8g=' 
WHERE 
  key_id = '802f1936ff690cb77358a0e246c913975c2d6c07b496ab8b73e911bb59ef2e08' 
  AND (
    token = 'TuRAPU0mH+9a1W7BMA7vKNi2tLKoCwstEREpDMhUT8g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040