UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8J6sYXZA2mKt0ncl9Wkd9yAGqsjfrDMPH/ovX1ny/3c=' 
WHERE 
  key_id = '3a79c172969716136585395ddf5274d5557286be53aefbe497cd4eaa9c55d400' 
  AND (
    token = '8J6sYXZA2mKt0ncl9Wkd9yAGqsjfrDMPH/ovX1ny/3c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034