UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O9bgmiMK4HawDuwypyl8AQtuIhn12+p+peiEm1SXiJE=' 
WHERE 
  key_id = '7bc2cbfd76d395490e8f0f80413291d5984c5327d6a9a2e28331eef0b8196c57' 
  AND (
    token = 'O9bgmiMK4HawDuwypyl8AQtuIhn12+p+peiEm1SXiJE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051