UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sbGsNeL47Bq+DfO51EY9zNFHlktQo23nLL4/gEiUsoI=' 
WHERE 
  key_id = 'b87fdf16c78c2a560a87022e59401da587d31f609f74ebfa87ae413ffb3dee81' 
  AND (
    token = 'sbGsNeL47Bq+DfO51EY9zNFHlktQo23nLL4/gEiUsoI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030