UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hDd1WLeGjSIn1WDtg7oyW1/nF8VptnJJ+3FbLEroW80=' 
WHERE 
  key_id = '78c926849920470cc421304f1bfd27668992f38243fbff33779848ed45ab8889' 
  AND (
    token = 'hDd1WLeGjSIn1WDtg7oyW1/nF8VptnJJ+3FbLEroW80=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028