UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8yuesJN8yAaTjzzO2/FHmY4zhRMFgG3Oz9t4bsk3VtQ=' 
WHERE 
  key_id = '46ab420cfb347b5d7213e35996150b710014b8c83efca3ff70ae328149f3d459' 
  AND (
    token = '8yuesJN8yAaTjzzO2/FHmY4zhRMFgG3Oz9t4bsk3VtQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023