UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cmWL5FBZvjNKpuo19n8PKNDTLpJieRPLnz7cEJTtdRg=' 
WHERE 
  key_id = 'd289ac00f255c71afd624004e02bd596610946e4e58ff21e1b7425f98c3664f9' 
  AND (
    token = 'cmWL5FBZvjNKpuo19n8PKNDTLpJieRPLnz7cEJTtdRg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032