UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FtLMgAdA7byaebktdR74DyycCTkWrwQl8d3phI1uEKI=' 
WHERE 
  key_id = '43493ec877813906ee198cc78ee72efc973df643df1f83d649b2195469bf8a0f' 
  AND (
    token = 'FtLMgAdA7byaebktdR74DyycCTkWrwQl8d3phI1uEKI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027