UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TlYLp58x10wgfXpmaF1YuiUn80y2FXT77RwgecGExRM=' 
WHERE 
  key_id = '7e1527362b0df200e0a4d8ebab13170e835f911c576bd978554e23171f0d6b11' 
  AND (
    token = 'TlYLp58x10wgfXpmaF1YuiUn80y2FXT77RwgecGExRM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025