UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bF+cnFR7bfsrnedH8fyFQ2ht7VZPRSN+iR+mMHipZro=' 
WHERE 
  key_id = 'f09311a73f2320022f1775b7d6fc610aca509c1566b9a03272bcbb0d56fd4a3f' 
  AND (
    token = 'bF+cnFR7bfsrnedH8fyFQ2ht7VZPRSN+iR+mMHipZro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036