UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n/6zbDPYtziN5ivknCZspAWjxd8hqCbca8ScOuLlDNs=' 
WHERE 
  key_id = '0f6e5091ff2637e7f476a4668b97a1504fb2d3897b6c93fe33b665130becf757' 
  AND (
    token = 'n/6zbDPYtziN5ivknCZspAWjxd8hqCbca8ScOuLlDNs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045